<?php  
//Set values for page
$page_title = "Login | PHP Include Demo";
$current_page = "login";

require_once 'global.inc.php';  

$error = "";
$username = "";
$password = "";

//check to see if they've submitted the login form  
if(isset($_POST['submit-login'])) {

	$username = $_POST['username'];
	$password = $_POST['password'];

	$userTools = new UserTools();
	if($userTools->login($username, $password)){
		//successful login, redirect them to a page
		header("Location: index.php");
	} else{
		$error = "Incorrect username or password. Please try again.";
	}
}
?>
<!DOCTYPE html>
<html lang="en">
	<?php include 'includes/header.php';?>
<body>
	<?php include 'includes/menu.php';?>
	<?php //include 'includes/slideshow.php';?>
	<div class="container" style="margin-top:60px;">
		<div class="row">
			<div class="span12">
				<?php  
				if($error != "")  
				{  
					echo $error."<br/>";
				}  
				?>  
				<form action="login.php" method="post">
					Username: <input type="text" name="username" value="<?php echo $username; ?>" /><br/>
					Password: <input type="password" name="password" value="<?php echo $password; ?>" /><br/>
					<input type="submit" value="Login" name="submit-login" />
				</form> 
			</div>
		</div>
	</div>
	<?php include 'includes/footer.php';?>
	<!-- javascript -->
	<script src="js/jquery.js"></script>
	<script src="js/bootstrap.js"></script>
	</body>
</html>